﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Site3AI.Models;

namespace Site3AI.Controllers
{
    [Authorize]
    public class _BaseController : Controller
    {
        Lazy<SiteDbEntities> _SiteDB=new Lazy<SiteDbEntities>();
        Lazy<Site3AIEntities> _DB=new Lazy<Site3AIEntities>();
        public Site3AIEntities DB
        {
            get
            {
                return _DB.Value;
            }
        }

        public SiteDbEntities SiteDB
        {
            get
            {
                return _SiteDB.Value;
            }
        }



        

        protected override void Dispose(bool disposing)
        {
            try
            {
                if (_DB.IsValueCreated) _DB.Value.Dispose();
            }
            catch { }
            try
            {
                if (_SiteDB.IsValueCreated) _SiteDB.Value.Dispose();
            }
            catch { }
            base.Dispose(disposing);
        }
    }
}
